﻿using DGIS.Service.IService.IGeometryService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geometry;

namespace DGIS.Service.Service.GeometryService
{
    public class GeometryRelationService : IGeometryRelationService
    {
        public bool CheckContain(IGeometry geometryA, IGeometry geometryB)
        {
            IRelationalOperator relationalOperator = geometryA as IRelationalOperator;
            return relationalOperator.Contains(geometryB);
        }

        public bool CheckCross(IGeometry geometryA, IGeometry geometryB)
        {
            IRelationalOperator relationalOperator = geometryA as IRelationalOperator;
            return relationalOperator.Crosses(geometryB);
        }

        public bool CheckTouch(IGeometry geometryA, IGeometry geometryB)
        {
            IRelationalOperator relationalOperator = geometryA as IRelationalOperator;
            return relationalOperator.Touches(geometryB);
        }

        public double GetMinDistance(IGeometry geometryA, IGeometry geometryB)
        {
            IProximityOperator proximityOperator = geometryA as IProximityOperator;
            double distance = proximityOperator.ReturnDistance(geometryB);

            return distance;
        }
    }
}
